import { AirBags, Engine } from './dependencies';

export class Car {
  public brand: string;
  public engin: Engine;
  public airBags: AirBags;
  constructor(
    brand: string,
    displacement: number,
    cylinder: number, 
    count: number,
    delay: number
  ) {
    this.brand = brand;
    this.engin = new Engine(displacement, cylinder);
    this.airBags = new AirBags(count, delay);
    console.log(
      `constructor one ${brand} car with ${displacement} cc engine and ${cylinder} cylinders`
    );
  }

  run() {
    this.engin.start();
    console.log(`${this.brand} car is running`);
  }

  onAccident() {
    this.engin.stop();
    this.airBags.deploy('accident');
  }
}
